package com.hs.wa.controller;

import com.hs.wa.service.ArticleService;
import com.springnew.model.ArticleWithBLOBs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
@CrossOrigin
public class ArticleController {

	@Autowired
	private ArticleService articleService;

	@PostMapping("/addArticle")
	private boolean addArticle(ArticleWithBLOBs article) {
		System.out.println(article);
		articleService.addArticleService(article);
		return true;

	}

	@PostMapping("/addArticleput")
	@ResponseBody
	private String addArticleput(ArticleWithBLOBs article) {
		articleService.addArticleService(article);
		System.out.println(article);
		return "true";

	}

	@GetMapping("/getArticle/{userId}")

	private boolean getArticle(String article, @PathVariable String userId) {
		/*  SUCESSED
		 * null 1
		 *  */
		System.out.println(article + " " + userId);
		return true;

	}
}
